using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace FCalendar
{
    public partial class FormOption : Form
    {
        public FormOption()
        {
            InitializeComponent();
            LoadData();
        }

        private void LoadData()
        {
            colorPickerDay.SelectedColor = FCalendar.Properties.Settings.Default.DayColor;
            colorPickerMonth.SelectedColor = FCalendar.Properties.Settings.Default.MonthColor;
            checkBoxAntiAlias.Checked = FCalendar.Properties.Settings.Default.AntiAlias;
            checkBox1.Checked = FCalendar.Properties.Settings.Default.BoxTopMost;
        }

        private void SaveData()
        {
            FCalendar.Properties.Settings.Default.DayColor = colorPickerDay.SelectedColor;
            FCalendar.Properties.Settings.Default.MonthColor = colorPickerMonth.SelectedColor;
            FCalendar.Properties.Settings.Default.AntiAlias = checkBoxAntiAlias.Checked;
            FCalendar.Properties.Settings.Default.BoxTopMost = checkBox1.Checked;
            FCalendar.Properties.Settings.Default.Save();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Program.mainForm.ShowDate();
            SaveData();
            Close();
        }

        private void trackBar1_Scroll(object sender, EventArgs e)
        {
            FormBox f = (FormBox)Program.fbox;
            f.Opacity = (double)trackBar1.Value / 100;
        }

        private void FormOption_Load(object sender, EventArgs e)
        {
            trackBar1.Value = (int)(Program.fbox.Opacity * 100);
        }

        private void FormOption_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (e.CloseReason == CloseReason.UserClosing)
            {
                e.Cancel = true;
                Hide();
            }
        }

        private void colorPickerDay_Click(object sender, EventArgs e)
        {

        }
    }
}